<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="utf-8">
    <title>登陆页面</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="description" content="">
    <meta name="author" content="">
    <!-- CSS -->
    <link rel="stylesheet" th:href="@{/css/reset.css}">
    <link rel="stylesheet" th:href="@{/css/supersized.css}">
    <link rel="stylesheet" th:href="@{/css/style.css}">
    <!-- HTML5 shim, for IE6-8 support of HTML5 elements -->
    <!--[if lt IE 9]>
    <script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
    <![endif]-->
</head>
<body>
<div class="page-container">
    <h1>登陆</h1>
    <div>
        <input  id="user" type="text" name="user" class="user" placeholder="输入用户名/邮箱/手机号">
        <input  id="room" type="text" name="room" class="room" placeholder="输入登录密码">
        <button  id="btn_login" type="submit">登陆</button>
        <div>

        </div>

        <!-- Javascript -->
        <script th:src="@{/js/jquery-1.8.2.min.js}"></script>
        <script th:src="@{/js/supersized.3.2.7.min.js}"></script>
        <script th:src="@{/js/supersized-init.js}"></script>
        <script th:src="@{/js/toast_367A9.js}"></script>
        <script th:src="@{/js/scripts.js}"></script>
        <script type="text/javascript" >
            $(function(){

                $("#btn_login").click(function(){ //登录

                    var room = $("#room").val();
                    var user = $("#user").val();
                    if (user == '') {
                        ToastShow("登录帐号不能为空");
                        return false;
                    }
                    if (room == '') {
                        ToastShow("登录密码不为空");
                        return false;
                    }
                    var json={room:room,user:user};
                    $.ajax({
                        url : "/v1/login",
                        type: 'POST',
                        dataType:'json',
                        contentType:"application/json",
                        data: JSON.stringify(json),
                        dataType:"text",
                        success : function(data) {

                            var dats=JSON.parse(data);

                            if (dats.status==200){

                                ToastShow("登陆成功");
                                var loginuser=dats.data;
                               console.log(data);
                            } else{

                                ToastShow(dats.msg);
                            }
                        },
                        error : function(req, err, ex) {
                            $("#txtRep").val(req.responseText + "\r\n" + err + "\r\n" + ex);
                        }
                    });




                });

            });

        </script>
    </div>
</div>
</body>

</html>



